#include "sgMpi.h"

#include "mpi.h"

using namespace SG::Algebra;

/**
 * KNOWLEDGES ABOUT MPI.
 *
 * A proven concept from early message-passing libraries is the notion of collective operation,
 * performed by all the processes in a computation.
 *
 * In MPI, communication involving more than two processes is collective, and all participating
 * processes call the same routine.
 *
 * @see Gropp W D. Using MPI. MIT Press, 1994.
 */

//=============================================================================
// Mpi

int Mpi::world_rank ()
{
    int world_rank;
    MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
    return world_rank;
}

int Mpi::world_size ()
{
    int world_size;
    MPI_Comm_size(MPI_COMM_WORLD, &world_size);
    return world_size;
}